<?php
//字符集
header("content-type:text/html;charset=utf-8;");

//连接增删改查数据库
include './login_CRUD.php';

//连接mysql
$coon = connectDB('127.0.0.1','root','qq553408','test2106');

//通过POST书id和用户名
$bid = $_GET["bid"];
$username = $_GET["username"];

//cookie过期时间
$outtime = time()+60*60*24;

//查询 书架是否有书
$sql = "SELECT *FROM books WHERE `username` = '$username' AND `bid` = '$bid'"; 
$res = mysqli_query($coon,$sql);

// //测试数据库是否连接成功
if(!$coon){
    //连接失败直接打出GG
    die('error for mysql: ' . mysqli_error($coon));
}
// //连接成功
else{
    //比较数据库id
    $row = mysqli_fetch_assoc($res);
    if ($row && $bid!="" && $username!="") {
        $result = 1;
        echo $result;
    } else {
        $result = 0;
        echo $result;
    }
};

?>